const router=require('koa-router')()
const {
    fetchHomePage
} =require('../api')

router.get('/home',async (ctx,next)=>{
    // console.log('???')
    try {
        const data=await fetchHomePage();
        // console.log('---',data,'----')
        let resData={
            code:"0",
            msg:"success"
        }
        if (data.errorCode===0){
            resData.data=data
        }else{
            resData.code="1";
            resData.msg="fail"
        }
        ctx.body=resData
    } catch (error) {
        next(error)
    }
})

module.exports=router.routes();